home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / src / binutils.252 / ld / scriptte / elf.sc < prev    next >
Encoding:
Text File  |  1994-10-14  |  4.6 KB  |  122 lines

  1. #
  2. # Unusual variables checked by this code:
  3. #    NOP - two byte opcode for no-op (defaults to 0)
  4. #    DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
  5. #    OTHER_READONLY_SECTIONS - other than .text .init .ctors .rodata ...
  6. #        (e.g., .PARISC.milli)
  7. #    OTHER_READWRITE_SECTIONS - other than .data .bss .sdata ...
  8. #        (e.g., .PARISC.global)
  9. #    OTHER_SECTIONS - at the end
  10. #    EXECUTABLE_SYMBOLS - symbols that must be defined for an
  11. #        executable (e.g., _DYNAMIC_LINK)
  12. #    TEXT_START_SYMBOLS - symbols that appear at the start of the
  13. #        .text section.
  14. #    DATA_START_SYMBOLS - symbols that appear at the start of the
  15. #        .data section.
  16. #    OTHER_BSS_SYMBOLS - symbols that appear at the start of the
  17. #        .bss section besides __bss_start.
  18. #    DATA_PLT - .plt should be in data segment, not text segment.
  19. #
  20. # When adding sections, do note that the names of some sections are used
  21. # when specifying the start address of the next.
  22. #
  23. test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
  24. test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
  25. test "$LD_FLAG" = "N" && DATA_ADDR=.
  26. INTERP=".interp   ${RELOCATING-0} : { *(.interp)     }"
  27. PLT=".plt    ${RELOCATING-0} : { *(.plt)    }"
  28. cat <<EOF
  29. OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
  30.           "${LITTLE_OUTPUT_FORMAT}")
  31. OUTPUT_ARCH(${ARCH})
  32.  
  33. ${RELOCATING+${LIB_SEARCH_DIRS}}
  34. ${RELOCATING+/* Do we need any of these for elf?
  35.    __DYNAMIC = 0; ${STACKZERO+${STACKZERO}} ${SHLIB_PATH+${SHLIB_PATH}}  */}
  36. ${RELOCATING+${EXECUTABLE_SYMBOLS}}
  37. ${RELOCATING- /* For some reason, the Solaris linker makes bad executables
  38.   if gld -r is used and the intermediate file has sections starting
  39.   at non-zero addresses.  Could be a Solaris ld bug, could be a GNU ld
  40.   bug.  But for now assigning the zero vmas works.  */}
  41. SECTIONS
  42. {
  43.   /* Read-only sections, merged into text segment: */
  44.   ${CREATE_SHLIB-${RELOCATING+. = ${TEXT_START_ADDR} + SIZEOF_HEADERS;}}
  45.   ${CREATE_SHLIB+${RELOCATING+. = SIZEOF_HEADERS;}}
  46.   ${CREATE_SHLIB-${INTERP}}
  47.   .hash        ${RELOCATING-0} : { *(.hash)        }
  48.   .dynsym      ${RELOCATING-0} : { *(.dynsym)        }
  49.   .dynstr      ${RELOCATING-0} : { *(.dynstr)        }
  50.   .rel.text    ${RELOCATING-0} : { *(.rel.text)        }
  51.   .rela.text   ${RELOCATING-0} : { *(.rela.text)     }
  52.   .rel.data    ${RELOCATING-0} : { *(.rel.data)        }
  53.   .rela.data   ${RELOCATING-0} : { *(.rela.data)     }
  54.   .rel.rodata  ${RELOCATING-0} : { *(.rel.rodata)     }
  55.   .rela.rodata ${RELOCATING-0} : { *(.rela.rodata)     }
  56.   .rel.got     ${RELOCATING-0} : { *(.rel.got)        }
  57.   .rela.got    ${RELOCATING-0} : { *(.rela.got)        }
  58.   .rel.ctors   ${RELOCATING-0} : { *(.rel.ctors)    }
  59.   .rela.ctors  ${RELOCATING-0} : { *(.rela.ctors)    }
  60.   .rel.dtors   ${RELOCATING-0} : { *(.rel.dtors)    }
  61.   .rela.dtors  ${RELOCATING-0} : { *(.rela.dtors)    }
  62.   .rel.bss     ${RELOCATING-0} : { *(.rel.bss)        }
  63.   .rela.bss    ${RELOCATING-0} : { *(.rela.bss)        }
  64.   .rel.plt     ${RELOCATING-0} : { *(.rel.plt)        }
  65.   .rela.plt    ${RELOCATING-0} : { *(.rela.plt)        }
  66.   .init        ${RELOCATING-0} : { *(.init)    } =${NOP-0}
  67.   ${DATA_PLT-${PLT}}
  68.   .text    ${RELOCATING-0} :
  69.   {
  70.     ${RELOCATING+${TEXT_START_SYMBOLS}}
  71.     *(.text)
  72.   }
  73.   ${RELOCATING+_etext = .;}
  74.   ${RELOCATING+PROVIDE (etext = .);}
  75.   .fini    ${RELOCATING-0} : { *(.fini)    } =${NOP-0}
  76.   .ctors   ${RELOCATING-0} : { *(.ctors)   }
  77.   .dtors   ${RELOCATING-0} : { *(.dtors)   }
  78.   .rodata  ${RELOCATING-0} : { *(.rodata)  }
  79.   .rodata1 ${RELOCATING-0} : { *(.rodata1) }
  80.   ${RELOCATING+${OTHER_READONLY_SECTIONS}}
  81.  
  82.   /* Read-write section, merged into data segment: */
  83.   ${RELOCATING+. = ${DATA_ADDR- ALIGN(8) + ${MAXPAGESIZE}};}
  84.   .data  ${RELOCATING-0} :
  85.   {
  86.     ${RELOCATING+${DATA_START_SYMBOLS}}
  87.     *(.data)
  88.     ${CONSTRUCTING+CONSTRUCTORS}
  89.   }
  90.   .data1 ${RELOCATING-0} : { *(.data1) }
  91.   ${RELOCATING+${OTHER_READWRITE_SECTIONS}}
  92.   .got         ${RELOCATING-0} : { *(.got.plt) *(.got) }
  93.   .dynamic     ${RELOCATING-0} : { *(.dynamic) }
  94.   ${DATA_PLT+${PLT}}
  95.   /* We want the small data sections together, so single-instruction offsets
  96.      can access them all, and initialized data all before uninitialized, so
  97.      we can shorten the on-disk segment size.  */
  98.   .sdata   ${RELOCATING-0} : { *(.sdata) }
  99.   ${RELOCATING+_edata  =  .;}
  100.   ${RELOCATING+PROVIDE (edata = .);}
  101.   ${RELOCATING+__bss_start = .;}
  102.   ${RELOCATING+${OTHER_BSS_SYMBOLS}}
  103.   .sbss    ${RELOCATING-0} : { *(.sbss) *(.scommon) }
  104.   .bss     ${RELOCATING-0} :
  105.   {
  106.    *(.dynbss)
  107.    *(.bss)
  108.    *(COMMON)
  109.   }
  110.   ${RELOCATING+_end = . ;}
  111.   ${RELOCATING+PROVIDE (end = .);}
  112.  
  113.   /* These are needed for ELF backends which have not yet been
  114.      converted to the new style linker.  */
  115.   .stab 0 : { *(.stab) }
  116.   .stabstr 0 : { *(.stabstr) }
  117.  
  118.   /* These must appear regardless of ${RELOCATING}.  */
  119.   ${OTHER_SECTIONS}
  120. }
  121. EOF
  122.